import React, { useState } from 'react';
import { Text, View, Button, Dimensions } from 'react-native';
import * as ImagePicker from 'expo-image-picker';

const Detail = () => {
	const [imageUrl,setImageUrl] = useState(null);

	const width = Dimensions.get('window').width;
	const height = Dimensions.get('window').height;

	const pickImage = async() => {
		let result = await ImagePicker.launchImageLibraryAsync({
			allowsEditing: true,
			quality: 1,
		  });
	  
		  if (!result.canceled) {
			setImageUrl(result.assets[0].uri);
		  } else {
			alert('You did not select any image.');
		  }
	}
	return (
		<View>
			<Text>个人信息</Text>
			<Button title='选择图片' onPress={pickImage} />
			<Text>屏幕宽为：{width}</Text>
			<Text>屏幕高为：{height}</Text>
		</View>
	)
}

export default Detail;